Strict

Import agfx

Global myTmpScreen:TTmpScreen

Class TAgfx_test_app Extends TFramework

	Method OnCreate:Int()
		
		Super.OnCreate()
				
		myTmpScreen = New TTmpScreen		
		myTmpScreen.Prepare()
		
		Return 0
	End
	
End


Class TTmpScreen Extends TScreen
	
	Field particle_image:TImage
	Field PMgr:TParticleManager = New TParticleManager

	' START when app is created
	Method Start:Void()
		IMAGES.Load("spark.png","SPARK")
	End
	
	' main app logic loop update
	Method Update:Void()
		Local gx# = 0.0, gy# = 0.0
		For Local i:Int = 0 To 32
			If TouchDown(i)
				#if TARGET = "android" Or TARGET = "ios" 
								gx = 2 * AccelX()				
								gy = 2* AccelY()
				#endif
				PMgr.AddParticleEmitter(TouchX(i), TouchY(i), 2, 100, IMAGES.Find("SPARK"), gx, gy)
			End If
		Next
		
		PMgr.Update()
	End
	
	' main app render loop
	Method Render:Void()
		Cls
		PMgr.Render()
	End
End
